package com.sgb.merchant.viewmodel;

import android.app.Application;

import androidx.annotation.NonNull;
import androidx.lifecycle.MutableLiveData;



import com.sgb.link.entity.merchant.EnrolInfoEntiy;
import com.sgb.merchant.api.MerchantsNet;
import com.sgb.net.entity.ListResponse;
import com.swgk.core.base.api.ICallBack;
import com.swgk.core.base.model.entity.BaseEntity;
import com.swgk.core.common.base.BaseViewModel;
import com.swgk.core.dialog.DialogHelper;
import com.swgk.core.util.MToast;

import org.jetbrains.annotations.NotNull;

import java.util.List;

import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;


public class EnrolListViewModel extends BaseViewModel {

   public MutableLiveData<ListResponse<List<EnrolInfoEntiy>>> ldList=new MutableLiveData<>();

    public EnrolListViewModel(@NonNull @NotNull Application application) {
        super(application);
    }

    public void getEnrolList(Long no,int page){
        MerchantsNet.getInstance().getService().getEnrolList(no,page,20).enqueue(new ICallBack<BaseEntity<ListResponse<List<EnrolInfoEntiy>>>>() {
            @Override
            public void onSuccess(BaseEntity<ListResponse<List<EnrolInfoEntiy>>> data) {
                if(data.isSuccess()){
                    ldList.postValue(data.getData());
                }
            }
        });
    }
}
